package siac.com.entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;


/**
 * The persistent class for the fac_lote database table.
 * 
 */
@Entity
@Table(name="FacLote")
@NamedQueries({
		@NamedQuery(name = "FacLote.findAll", query = "SELECT e FROM FacLote e"),
		@NamedQuery(name = "FacLote.findById", query = "SELECT e FROM FacLote e WHERE e.id = :idTabela"),
		@NamedQuery(name = "FacLote.findByCode", query = "SELECT e FROM FacLote e WHERE e.code = :code"),
		@NamedQuery(name = "FacLote.findByDataLote", query = "SELECT e FROM FacLote e WHERE e.dataLote = :dataLote"),
		@NamedQuery(name = "FacLote.findByStatus", query = "SELECT e FROM FacLote e WHERE e.status = :status"),
		@NamedQuery(name = "FacLote.findByMoeda", query = "SELECT e FROM FacLote e WHERE e.moeda = :moeda"),
		@NamedQuery(name = "FacLote.findByLocAtendimento", query = "SELECT e FROM FacLote e WHERE e.localAtendimento = :locAtendimento") })
public class FacLote implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	private Long id;
	@org.hibernate.annotations.NaturalId
	@Basic(optional = false)
	@Column(nullable = false, length = 10)
	private String code;
    @Temporal( TemporalType.DATE)
	private Date dataLote;
	@Basic(optional = false)
	@Column(nullable = false, length = 50)
	private String localAtendimento;
	private Integer numeroFacturas;
	private BigDecimal valorTotalLote;
	@Temporal(TemporalType.TIMESTAMP)
	private Date dataRegisto;
	private Long operadorRegisto;
	@Temporal(TemporalType.TIMESTAMP)
	private Date dataAlteracao;
	private Long operadorAlteracao;
    @JoinColumn(name = "idMoeda", referencedColumnName = "id", nullable = false)
    @ManyToOne(optional = false) //, fetch = FetchType.EAGER
	private FacStatus moedaLote = new FacStatus();
    @JoinColumn(name = "idStatus", referencedColumnName = "id", nullable = false)
    @ManyToOne(optional = false) //, fetch = FetchType.EAGER
	private FacStatus statusLote = new FacStatus();

    public FacLote() {
    }

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public Date getDataLote() {
		return dataLote;
	}

	public void setDataLote(Date dataLote) {
		this.dataLote = dataLote;
	}

	public String getLocalAtendimento() {
		return localAtendimento;
	}

	public void setLocalAtendimento(String localAtendimento) {
		this.localAtendimento = localAtendimento;
	}

	public Integer getNumeroFacturas() {
		return numeroFacturas;
	}

	public void setNumeroFacturas(Integer numeroFacturas) {
		this.numeroFacturas = numeroFacturas;
	}

	public BigDecimal getValorTotalLote() {
		return valorTotalLote;
	}

	public void setValorTotalLote(BigDecimal valorTotalLote) {
		this.valorTotalLote = valorTotalLote;
	}

	public Date getDataRegisto() {
		return dataRegisto;
	}

	public void setDataRegisto(Date dataRegisto) {
		this.dataRegisto = dataRegisto;
	}

	public Long getOperadorRegisto() {
		return operadorRegisto;
	}

	public void setOperadorRegisto(Long operadorRegisto) {
		this.operadorRegisto = operadorRegisto;
	}

	public Date getDataAlteracao() {
		return dataAlteracao;
	}

	public void setDataAlteracao(Date dataAlteracao) {
		this.dataAlteracao = dataAlteracao;
	}

	public Long getOperadorAlteracao() {
		return operadorAlteracao;
	}

	public void setOperadorAlteracao(Long operadorAlteracao) {
		this.operadorAlteracao = operadorAlteracao;
	}

	public FacStatus getMoedaLote() {
		return moedaLote;
	}

	public void setMoedaLote(FacStatus moedaLote) {
		this.moedaLote = moedaLote;
	}

	public FacStatus getStatusLote() {
		return statusLote;
	}

	public void setStatusLote(FacStatus statusLote) {
		this.statusLote = statusLote;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		FacLote other = (FacLote) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return code + " - " + dataLote;
	}
    
    

}